﻿package com.hnevc.shenhaibing.worldcupapp2018.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

import com.hnevc.shenhaibing.worldcupapp2018.R;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private ImageView back;
    private EditText name;
    private EditText password;
    private Button dengLu;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();


    }

    private void initView() {
        back = (ImageView) findViewById(R.id.back);
        name = (EditText) findViewById(R.id.name);
        password = (EditText) findViewById(R.id.password);
        dengLu = (Button) findViewById(R.id.deng_lu);
        dengLu.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.deng_lu:
                startActivity(new Intent(MainActivity.this,AllActivity.class));
                break;
        }
    }

    private void submit() {
        // validate
        String nameString = name.getText().toString().trim();
        if (TextUtils.isEmpty(nameString)) {
            Toast.makeText(this, "请输入用户名", Toast.LENGTH_SHORT).show();
            return;
        }

        String passwordString = password.getText().toString().trim();
        if (TextUtils.isEmpty(passwordString)) {
            Toast.makeText(this, "请输入密码", Toast.LENGTH_SHORT).show();
            return;
        }

        // TODO validate success, do something


    }
}
